package test1014;

public class Bank {
    private String name;
    private String accountNumber;
    private double balance;

    public Bank(String name, String accountNumber) {
        this.name = name;
        this.accountNumber = accountNumber;
        this.balance = 0.0;
    }

    public void deposit(double amount) {
        balance += amount;
        System.out.println("成功存入金额：" + amount);
        System.out.println("当前余额为：" + balance);
    }

    public void withdraw(double amount) {
        if (balance >= amount) {
            balance -= amount;
            System.out.println("成功取出金额：" + amount);
            System.out.println("当前余额为：" + balance);
        } else {
            System.out.println("余额不足，无法取款");
        }
    }

    public void displayAccountInfo() {
        System.out.println("姓名：" + name);
        System.out.println("卡号：" + accountNumber);
        System.out.println("当前余额为：" + balance);
    }
}
